package com.huaxin.hxmoduleworkorder.dto.request;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Builder;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 新增维修结果记录请求 DTO
 * <p>
 * 对应实体类：MaintenanceOrderResult
 * 用于接收维修完成后提交的处理结果信息，包括问题描述、解决方案、耗时、耗材、照片等。
 * 所有字段命名与实体类完全一致，确保映射准确。
 * 使用 jakarta.validation 进行参数校验。
 * </p>
 *
 * @author [你的名字或团队]
 * @since 2025-09-02
 */
@Data
@Builder
public class MaintenanceOrderElectricianTaskResultCreateReqDTO {
    @Schema(description = "维修工单ID，关联的工单", example = "mnt_order_001")
    @NotBlank(message = "维修工单ID不能为空")
    @Size(max = 50, message = "工单ID长度不能超过50个字符")
    private String maintenanceOrderId;

    @Schema(description = "工单电工任务ID", example = "mnt_order_electrician_task_001")
    @NotBlank(message = "工单电工任务ID不能为空")
    @Size(max = 50, message = "工单电工任务ID长度不能超过50个字符")
    private String maintenanceOrderElectricianTaskId;

    @Schema(description = "处理电工ID", example = "e1001")
    @NotBlank(message = "处理电工ID不能为空")
    @Size(max = 50, message = "电工ID长度不能超过50个字符")
    private String electricianId;

    @Schema(description = "问题描述，实际发现的故障原因", example = "零线接触不良导致跳闸")
    @NotBlank(message = "问题描述不能为空")
    @Size(max = 1000, message = "问题描述长度不能超过1000个字符")
    private String problemDescription;

    @Schema(description = "解决方案，实际采取的维修措施", example = "重新压接零线端子并加固")
    @NotBlank(message = "解决方案不能为空")
    @Size(max = 1000, message = "解决方案长度不能超过1000个字符")
    private String solution;

    @Schema(description = "工作时长（小时），支持小数", example = "1.5")
    @NotNull(message = "工作时长不能为空")
    @DecimalMin(value = "0.0", inclusive = true, message = "工作时长不能小于0")
    @DecimalMax(value = "24.0", inclusive = true, message = "工作时长不能超过24小时")
    private BigDecimal workHours;

    @Schema(description = "更换零件列表，JSON数组格式：[{\"name\":\"空开\",\"qty\":1,\"price\":80}]", example = "[{\"name\":\"空开\",\"qty\":1,\"price\":80}]")
    private List<Map<String, Object>> partsUsed;

    @Schema(description = "现场处理照片URL列表", example = "[\"https://oss/repair1.jpg\",\"https://oss/repair2.jpg\"]")
    private List<String> photoUrls;

    @Schema(description = "电子签名图片URL", example = "https://oss/sign.png")
    private String signImageUrl;

    @Schema(description = "电子签名图片Base64数据", example = "")
    private String signImageBase64Data;
}